New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: remove shebang when executing the code via vite-node #1224
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
The PR for vite is merged!! I'll rebase main branch after the next vite release and update this PR. |
Thanks for the PR in vite @togami2864! vite@2.9.8 has been released with it. |
e0210a4
to
0e2c402
Compare
packages/vite-node/src/client.ts
Outdated
@@ -178,7 +178,7 @@ export class ViteNodeRunner { | |||
}) | |||
|
|||
// add 'use strict' since ESM enables it by default | |||
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed}\n}}`, { | |||
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed.replace(/^\#\!.*/, '')}\n}}`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed.replace(/^\#\!.*/, '')}\n}}`, { | |
const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(',')})=>{{${transformed.replace(/^\#\!.*/, s => ' '.repeat(s.length))}\n}}`, { |
To avoid index changes.
fix #1175